<template>
  <div class="main">
    <Menu v-if="bookmarks?.length" :bookmarks="bookmarks"></Menu>
    <Upload v-else></Upload>
  </div>
</template>
<script lang="ts">
import { htmlSystem, $utils, request } from "@/utils";
import Upload from "./layout/upload/index.vue";
import Menu from "./layout/menu/index.vue";
const { getStorage, setStorage } = $utils;

export default {
  components: { Menu, Upload },
  data() {
    return {
      bookmarks: getStorage("bookmarks"),
    };
  },
  mounted: async function () {
    const hadInfo = getStorage("hadInfo");
    if (!hadInfo && !this.bookmarks) {
      const res = await request.GET("/bookmarks.html", {}, null, {
        type: "text"
      })
      this.bookmarks = htmlSystem.initHTML(res);
      setStorage("bookmarks", this.bookmarks);
    }
  },
};
</script>



<style>
* {
  margin: 0;
  padding: 0;
}
</style>
